package java44th.group.service.admin.stat;

import java44th.group.bean.admin.vo.stat.user.RowsEntity;
import java44th.group.mapper.MarketOrderMapper;
import java44th.group.mapper.MarketUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName project-second
 * @Descriptiom TODO
 * @Aurhor: 蔡文强
 * @Since: 2022/10/12 22:54
 */
@Service
public class StatServiceImpl implements StatService {

    @Autowired
    MarketUserMapper marketUserMapper;

    @Autowired
    MarketOrderMapper marketOrderMapper;



    @Override
    public List<RowsEntity> queryUserList() {

        List<RowsEntity> rowsEntities = marketUserMapper.selectUsersTotalAndDayGroupByAddTime();

        return rowsEntities;
    }

    @Override
    public List<java44th.group.bean.admin.vo.stat.order.RowsEntity> queryOrderList() {

        // 客单价 = 销售总额（除去打折等优惠之后的算下来的钱）÷顾客总数
        // 下单 ： 付款时间
        // amount  customers  day  orders  pcr
        List<java44th.group.bean.admin.vo.stat.order.RowsEntity> rowsEntities =
                marketOrderMapper.selectOrderStatGroupByPayTime();

        return rowsEntities;
    }

    @Override
    public List<java44th.group.bean.admin.vo.stat.goods.RowsEntity> queryGoodsList() {

        List<java44th.group.bean.admin.vo.stat.goods.RowsEntity> rowsEntities = marketOrderMapper.selectGoodsGroupByPayTime();

        return rowsEntities;
    }
}
